home *** CD-ROM | disk | FTP | other *** search
- package asp.netobjects.nfx.wizard;
-
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Toolkit;
- import java.awt.image.ImageObserver;
- import java.util.Enumeration;
- import java.util.Vector;
-
- class WizardPageView$ImageCanvas extends Canvas implements ImageObserver {
- // $FF: synthetic field
- private final WizardPageView this$0;
- private int dmTextYInc;
- private int dmWidth;
- private int dmHeight;
- private Image dmImage;
- private boolean dmPainted;
-
- public WizardPageView$ImageCanvas(WizardPageView this$0, int width, int height) {
- this.this$0 = this$0;
- this.this$0 = this$0;
- this.dmTextYInc = 12;
- this.dmPainted = false;
- this.dmWidth = width;
- this.dmHeight = height;
- }
-
- public Dimension getMinumumSize() {
- return new Dimension(this.dmWidth, this.dmHeight);
- }
-
- public Dimension getMaximumSize() {
- return new Dimension(this.dmWidth, this.dmHeight);
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(this.dmWidth, this.dmHeight);
- }
-
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
- return true;
- }
-
- private void drawText(Graphics g) {
- g.setColor(super.getBackground());
- g.fillRect(0, 0, this.dmWidth, this.dmHeight);
- int curY = 0;
- Dimension dim = ((Component)this).getSize();
- g.setColor(Color.black);
- Font plainFont = new Font("Helvetica", 0, 12);
- Font bulletFont = new Font("Helvetica", 1, 14);
- FontMetrics plainFontMet = Toolkit.getDefaultToolkit().getFontMetrics(plainFont);
- FontMetrics bulletFontMet = Toolkit.getDefaultToolkit().getFontMetrics(bulletFont);
- g.setFont(bulletFont);
- String s = this.this$0.getModel().getBulletText();
- int w = this.getMinumumSize().width;
- Vector v = WizardPageView.access$0(this.this$0, s, w, 999, bulletFontMet);
- Enumeration e = v.elements();
-
- while(e.hasMoreElements()) {
- curY += this.dmTextYInc;
- g.drawString((String)e.nextElement(), 0, curY);
- }
-
- String last = (String)v.lastElement();
- int lastWidth = bulletFontMet.charsWidth(last.toCharArray(), 0, last.length());
- if (lastWidth < w) {
- g.setFont(plainFont);
- s = " - " + this.this$0.getModel().getInfoText();
- v = WizardPageView.access$0(this.this$0, s, w - lastWidth, 1, plainFontMet);
- last = (String)v.lastElement();
- g.drawString(last, lastWidth, curY);
- s = s.substring(last.length() + 1);
- }
-
- v = WizardPageView.access$0(this.this$0, s, w, 999, plainFontMet);
- e = v.elements();
-
- while(e.hasMoreElements()) {
- curY += this.dmTextYInc;
- g.drawString((String)e.nextElement(), 0, curY);
- }
-
- }
-
- public void paint(Graphics g) {
- if (this.dmImage == null) {
- this.dmImage = ((Component)this).createImage(this.dmWidth, this.dmHeight);
- }
-
- if (this.dmImage != null) {
- Graphics g2 = this.dmImage.getGraphics();
- if (!this.dmPainted && this.this$0.getModel() != null) {
- this.drawText(g2);
- this.dmPainted = true;
- }
-
- g.drawImage(this.dmImage, 0, 0, this);
- }
-
- }
- }
-